/***************************************************************************
 *   Copyright (C) 2010 by programmeboy                                    *
 *   programmeboy@gmail.com                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.                                        *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
 ***************************************************************************/

#ifndef _CALLBACK__H__
#define _CALLBACK__H__

#include <ntifs.h>
#include "common.h"

typedef enum _CALLBACK_TYPE{
    emCallbackStart = 0,
    emPROCESS_CREATE = 0,
    emTHREAD_CREATE,
    emLOAD_IMAGE,
    emREGISTER,
    emLEGO,
    emSHUTDOWN,
    emCallbackEnd = emSHUTDOWN
}CALLBACK_TYPE;

typedef struct _SHUTDOWN_PACKET {
    LIST_ENTRY ListEntry;
    PDEVICE_OBJECT DeviceObject;
} SHUTDOWN_PACKET, *PSHUTDOWN_PACKET;

typedef struct _CALLBACK_CTX CALLBACK_CTX;

typedef 
BOOLEAN
(*FNCALLBACKINIT)(
    OUT CALLBACK_CTX* context
);

typedef
NTSTATUS
(*FNCALLBACKGETTER)(
    IN CALLBACK_CTX* context,
    OUT PVOID Buffer,
    IN  ULONG BufferLength,
    OUT PULONG Length  
);

typedef struct _CALLBACK_CTX{
    BOOLEAN Init;
    ULONG Offset;
    ULONG Counts;
    ULONG MaxCounts;
    FNCALLBACKINIT fnInit;
    FNCALLBACKGETTER fnGetter;
    //const WCHAR* Desc;
}CALLBACK_CTX, *PCALLBACK_CTX;

NTSTATUS
GetCallbacks(
    IN CALLBACK_TYPE Type,
    OUT PVOID Buffer,
    IN  ULONG BufferLength,
    OUT PULONG Length  
);

#endif
